
public class ArrayList {
	private int[] innerArray;
	private int elementsInArray;
	public ArrayList() {
		innerArray = new int[10];
		elementsInArray = 0;
	}
	
	public int get(int index) {
		if(index < innerArray.length && index >= 0) {
			return innerArray[index]; 
		}
		System.out.println("Error");
		return -1; 
	}
	
	public void add(int newElement) {
		if(elementsInArray >= innerArray.length) {
			int[] newArray = new int[innerArray.length * 10];
			for(int x = 0; x < innerArray.length; x++) {
				newArray[x] = innerArray[x];
			}
			newArray[elementsInArray] = newElement;
			innerArray = newArray;
		}
		else {
			innerArray[elementsInArray] = newElement;
		}
		elementsInArray++;
	}
	
	public int size() {
		return elementsInArray;
	}
}
